home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / applic / ntp / depredated / ntp.3.4 / patches / patch1.Z / patch1
Encoding:
Text File  |  1991-09-29  |  19.0 KB  |  760 lines

  1. System: ntp version 3.4
  2. Patch #: 1
  3. Priority: 
  4. Updated distribution directory.
  5.  
  6.     Add LIBS macro to Makefile directives which link ntp, ntpdc, ntpd and
  7.     test programs.
  8.  
  9.     Add symbolic version identifier to Makefile install targets for
  10.     proper directory name.
  11.  
  12.     Shorten timeout interval and clean up timeout message.
  13.  
  14.     Don't zero the drift compensation or compliance values when a step
  15.     adjustment of the clock occurs.  Use symbolic definition of
  16.     CLOCK_FACTOR rather than constant.
  17.  
  18.     sys.refid could have garbage left if the peer we're synchronized to
  19.     is lost.
  20.  
  21.     Diddle syslog messages a bit.  Handle case of udp/ntp not being
  22.     defined in /etc/services.  Compute default value for tickadj if
  23.     the change-kernel-tickadj flag is set, but no tickadj directive
  24.     is present in the configuration file.
  25.  
  26.     Delete unused variables.  Display interface address in numeric form
  27.     for local address, rather than symbolically.  For multiple host
  28.     queries, the name of the host is emitted prior to the data for that
  29.     host.
  30.  
  31.  
  32.  
  33. Repeat-By:
  34.  
  35. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your ntp source
  36.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  37.     If you don't have the patch program, apply the following by hand,
  38.     or get patch (version 2.0, latest patchlevel).
  39.  
  40.     After patching:
  41.         make depend
  42.         make
  43.         make install
  44.  
  45.     If patch indicates that patchlevel is the wrong version, you may need
  46.     to apply one or more previous patches, or the patch may already
  47.     have been applied.  See the patchlevel.h file to find out what has or
  48.     has not been applied.  In any event, don't continue with the patch.
  49.  
  50.     If you are missing previous patches (hah!) they can be obtained from me:
  51.  
  52.     Louis A. Mamakos
  53.     louie@trantor.umd.edu
  54.  
  55.     You can also get the patches via anonymous FTP from
  56.     trantor.umd.edu.
  57.  
  58. Index: patchlevel.h
  59. Prereq: 0
  60. 1c1
  61. < #define PATCHLEVEL 0
  62. ---
  63. > #define PATCHLEVEL 1
  64.  
  65. Index: Makefile
  66. Prereq: 3.4
  67. *** Makefile.old    Mon Mar 20 00:15:06 1989
  68. --- Makefile    Mon Mar 20 00:15:07 1989
  69. ***************
  70. *** 1,6 ****
  71. ! # $Header: /usr/users/louie/ntp/RCS/Makefile,v 3.4 89/03/17 18:36:37 louie Exp $
  72.   #
  73.   # $Log:    Makefile,v $
  74.   # Revision 3.4  89/03/17  18:36:37  louie
  75.   # Latest test release.
  76.   # 
  77. --- 1,13 ----
  78. ! # $Header: /usr/users/louie/ntp/RCS/Makefile,v 3.4.1.1 89/03/20 00:01:24 louie Exp Locker: louie $
  79.   #
  80.   # $Log:    Makefile,v $
  81. + # Revision 3.4.1.1  89/03/20  00:01:24  louie
  82. + # patch1: Add LIBS macro to Makefile directives which link ntp, ntpdc, ntpd and
  83. + # patch1: test programs.
  84. + # patch1:  
  85. + # patch1: Add symbolic version identifier to Makefile install targets for
  86. + # patch1: proper directory name.
  87. + # 
  88.   # Revision 3.4  89/03/17  18:36:37  louie
  89.   # Latest test release.
  90.   # 
  91. ***************
  92. *** 33,38 ****
  93. --- 40,48 ----
  94.   BINDIR=/usr/local/etc
  95.   LINKDIR=/etc
  96.   LIBS=
  97. + VERS=3.4
  98.   #CC=gcc -g -W -Wall
  99.   CC=gcc -g -W
  100.   
  101. ***************
  102. *** 97,116 ****
  103.       @./ntest
  104.   
  105.   ntp:    ntp.o ntpsubs.o
  106. !     ${CC} ${LDFLAGS} -o ntp ntp.o ntpsubs.o
  107.   
  108.   ntpd:    ${NTPDOBJ}
  109.       ${CC} ${LDFLAGS} -o ntpd ntpd.o ntpsubs.o ntp_adjust.o ntp_proto.o \
  110. !         ntp_sock.o
  111.   
  112.   ntpdc: ntpdc.o
  113. !     ${CC} ${LDFLAGS} -o ntpdc ntpdc.o
  114.   
  115.   ntest: test.o ntpsubs.o
  116. !     ${CC} ${LDFLAGS} -o ntest test.o ntpsubs.o
  117.   
  118.   sock_test: ntp_sock.c
  119. !     ${CC} ${LDFLAGS} -DTEST -o sock_test ntp_sock.c
  120.   
  121.   ${OBJS}:    ntp.h Makefile
  122.   
  123. --- 107,126 ----
  124.       @./ntest
  125.   
  126.   ntp:    ntp.o ntpsubs.o
  127. !     ${CC} ${LDFLAGS} -o ntp ntp.o ntpsubs.o ${LIBS}
  128.   
  129.   ntpd:    ${NTPDOBJ}
  130.       ${CC} ${LDFLAGS} -o ntpd ntpd.o ntpsubs.o ntp_adjust.o ntp_proto.o \
  131. !         ntp_sock.o ${LIBS}
  132.   
  133.   ntpdc: ntpdc.o
  134. !     ${CC} ${LDFLAGS} -o ntpdc ntpdc.o ${LIBS}
  135.   
  136.   ntest: test.o ntpsubs.o
  137. !     ${CC} ${LDFLAGS} -o ntest test.o ntpsubs.o ${LIBS}
  138.   
  139.   sock_test: ntp_sock.c
  140. !     ${CC} ${LDFLAGS} -DTEST -o sock_test ntp_sock.c ${LIBS}
  141.   
  142.   ${OBJS}:    ntp.h Makefile
  143.   
  144. ***************
  145. *** 150,159 ****
  146.       lint -bac ${DEFINES} ${NTPDSRC}
  147.   
  148.   dist:    ntp.tar.Z
  149. !     mv ntp.tar.Z /usr/ftp/pub/ntp.3.2/ntp.tar.Z
  150.   
  151.   test-dist:    ntp.tar.Z
  152. !     mv ntp.tar.Z /usr/ftp/pub/ntp.3.2/ntp-test.tar.Z
  153.   
  154.   ntp.tar.Z:    ${DIST}
  155.       ident ${DIST} | grep Header | \
  156. --- 160,169 ----
  157.       lint -bac ${DEFINES} ${NTPDSRC}
  158.   
  159.   dist:    ntp.tar.Z
  160. !     mv ntp.tar.Z /usr/ftp/pub/ntp.${VERS}/ntp.tar.Z
  161.   
  162.   test-dist:    ntp.tar.Z
  163. !     mv ntp.tar.Z /usr/ftp/pub/ntp.${VERS}/ntp-test.tar.Z
  164.   
  165.   ntp.tar.Z:    ${DIST}
  166.       ident ${DIST} | grep Header | \
  167.  
  168. Index: ntp.c
  169. Prereq: 3.4
  170. *** ntp.c.old    Mon Mar 20 00:15:10 1989
  171. --- ntp.c    Mon Mar 20 00:15:11 1989
  172. ***************
  173. *** 1,9 ****
  174.   #ifndef    lint
  175. ! static char *rcsid = "$Header: /usr/users/louie/ntp/RCS/ntp.c,v 3.4 89/03/17 18:36:54 louie Exp $";
  176.   #endif    lint
  177.   
  178.   /*
  179.    *  $Log:    ntp.c,v $
  180.    * Revision 3.4  89/03/17  18:36:54  louie
  181.    * Latest test release.
  182.    * 
  183. --- 1,12 ----
  184.   #ifndef    lint
  185. ! static char *rcsid = "$Header: /usr/users/louie/ntp/RCS/ntp.c,v 3.4.1.1 89/03/20 00:02:32 louie Exp Locker: louie $";
  186.   #endif    lint
  187.   
  188.   /*
  189.    *  $Log:    ntp.c,v $
  190. +  * Revision 3.4.1.1  89/03/20  00:02:32  louie
  191. +  * patch1: Shorten timeout interval and clean up timeout message.
  192. +  * 
  193.    * Revision 3.4  89/03/17  18:36:54  louie
  194.    * Latest test release.
  195.    * 
  196. ***************
  197. *** 93,99 ****
  198.       };
  199.   
  200.   #define RETRY_COUNT    2    /* number of times we want to retry */
  201. ! #define TIME_OUT        60    /* time to wait for reply, in secs */
  202.   
  203.   
  204.   struct sockaddr_in sin = {AF_INET};
  205. --- 96,102 ----
  206.       };
  207.   
  208.   #define RETRY_COUNT    2    /* number of times we want to retry */
  209. ! #define TIME_OUT        10    /* time to wait for reply, in secs */
  210.   
  211.   
  212.   struct sockaddr_in sin = {AF_INET};
  213. ***************
  214. *** 202,212 ****
  215.               exit(1);
  216.           }
  217.           if (n == 0) {
  218. !             fprintf(stderr,"\n\t* Timeout *\n");
  219.               if (--retry)
  220.                   --host;
  221.               else {
  222. !                 fprintf(stderr,"\nHost %s is not responding\n",
  223.                          argv[host]);
  224.                   retry = RETRY_COUNT;
  225.               }
  226. --- 205,215 ----
  227.               exit(1);
  228.           }
  229.           if (n == 0) {
  230. !             fprintf(stderr,"*Timeout*\n");
  231.               if (--retry)
  232.                   --host;
  233.               else {
  234. !                 fprintf(stderr,"Host %s is not responding\n",
  235.                          argv[host]);
  236.                   retry = RETRY_COUNT;
  237.               }
  238.  
  239. Index: ntp.h
  240. Prereq: 3.4
  241. *** ntp.h.old    Mon Mar 20 00:15:14 1989
  242. --- ntp.h    Mon Mar 20 00:15:15 1989
  243. ***************
  244. *** 1,7 ****
  245. ! /* $Header: /usr/users/louie/ntp/RCS/ntp.h,v 3.4 89/03/17 18:37:00 louie Exp $ */
  246.   
  247.   /*
  248.    *  $Log:    ntp.h,v $
  249.    * Revision 3.4  89/03/17  18:37:00  louie
  250.    * Latest test release.
  251.    * 
  252. --- 1,10 ----
  253. ! /* $Header: /usr/users/louie/ntp/RCS/ntp.h,v 3.4.1.1 89/03/20 00:02:53 louie Exp Locker: louie $ */
  254.   
  255.   /*
  256.    *  $Log:    ntp.h,v $
  257. +  * Revision 3.4.1.1  89/03/20  00:02:53  louie
  258. +  * 1
  259. +  * 
  260.    * Revision 3.4  89/03/17  18:37:00  louie
  261.    * Latest test release.
  262.    * 
  263. ***************
  264. *** 150,156 ****
  265.   #define    CLOCK_FREQ    10    /* frequency shift */
  266.   #define    CLOCK_TRACK    8
  267.   #define    CLOCK_COMP    4
  268. ! #define    CLOCK_FACTOR    18    /* 18?? */
  269.   
  270.   /*
  271.    * Structure definitions for NTP fixed point values
  272. --- 153,159 ----
  273.   #define    CLOCK_FREQ    10    /* frequency shift */
  274.   #define    CLOCK_TRACK    8
  275.   #define    CLOCK_COMP    4
  276. ! #define    CLOCK_FACTOR    18
  277.   
  278.   /*
  279.    * Structure definitions for NTP fixed point values
  280.  
  281. Index: ntp_adjust.c
  282. Prereq: 3.4
  283. *** ntp_adjust.c.old    Mon Mar 20 00:15:18 1989
  284. --- ntp_adjust.c    Mon Mar 20 00:15:19 1989
  285. ***************
  286. *** 1,5 ****
  287.   #ifndef lint
  288. ! static char *RCSid = "$Header: /usr/users/louie/ntp/RCS/ntp_adjust.c,v 3.4 89/03/17 18:37:03 louie Exp $";
  289.   #endif
  290.   
  291.   /*
  292. --- 1,5 ----
  293.   #ifndef lint
  294. ! static char *RCSid = "$Header: /usr/users/louie/ntp/RCS/ntp_adjust.c,v 3.4.1.1 89/03/20 00:09:06 louie Exp Locker: louie $";
  295.   #endif
  296.   
  297.   /*
  298. ***************
  299. *** 7,12 ****
  300. --- 7,17 ----
  301.    * 5. of the NTP specification.
  302.    *
  303.    * $Log:    ntp_adjust.c,v $
  304. +  * Revision 3.4.1.1  89/03/20  00:09:06  louie
  305. +  * patch1: Don't zero the drift compensation or compliance values when a step
  306. +  * patch1: adjustment of the clock occurs.  Use symbolic definition of
  307. +  * patch1: CLOCK_FACTOR rather than constant.
  308. +  * 
  309.    * Revision 3.4  89/03/17  18:37:03  louie
  310.    * Latest test release.
  311.    * 
  312. ***************
  313. *** 147,160 ****
  314.               return(-1);
  315.           }
  316.           clock_adjust = 0.0;
  317. -         /*
  318. -          * I reset the drift_comp here since things were screwed
  319. -          * up very bad if the clock reset and you can't be sure
  320. -          * if the drift_comp was meaningful.  Also mark us restarting
  321. -          * the recurance and reset the update timer.
  322. -          */
  323. -         drift_comp = 0.0;
  324. -         compliance = 0.0;
  325.           firstpass = 1;
  326.           update_timer = 0;
  327.           return (1);      /* indicate that step adjustment was done */
  328. --- 152,157 ----
  329. ***************
  330. *** 172,178 ****
  331.               firstpass = 0;
  332.           else if (update_timer > 0) {
  333.               ai = abs(compliance);
  334. !             ai = (double)(1<<CLOCK_COMP) - (double)(1<<18) * ai;
  335.               if (ai < 1.0)        /* max(... , 1.0) */
  336.                   ai = 1.0;
  337.               drift_comp += offset / (ai * (double)update_timer);
  338. --- 169,176 ----
  339.               firstpass = 0;
  340.           else if (update_timer > 0) {
  341.               ai = abs(compliance);
  342. !             ai = (double)(1<<CLOCK_COMP) - 
  343. !                 (double)(1<<CLOCK_FACTOR) * ai;
  344.               if (ai < 1.0)        /* max(... , 1.0) */
  345.                   ai = 1.0;
  346.               drift_comp += offset / (ai * (double)update_timer);
  347.  
  348. Index: ntp_proto.c
  349. Prereq: 3.4
  350. *** ntp_proto.c.old    Mon Mar 20 00:15:22 1989
  351. --- ntp_proto.c    Mon Mar 20 00:15:23 1989
  352. ***************
  353. *** 1,5 ****
  354.   #ifndef    lint
  355. ! static char *rcsid = "$Header: /usr/users/louie/ntp/RCS/ntp_proto.c,v 3.4 89/03/17 18:37:05 louie Exp $";
  356.   #endif
  357.   
  358.   /*
  359. --- 1,5 ----
  360.   #ifndef    lint
  361. ! static char *rcsid = "$Header: /usr/users/louie/ntp/RCS/ntp_proto.c,v 3.4.1.1 89/03/20 00:10:06 louie Exp Locker: louie $";
  362.   #endif
  363.   
  364.   /*
  365. ***************
  366. *** 10,15 ****
  367. --- 10,19 ----
  368.    *
  369.    *
  370.    * $Log:    ntp_proto.c,v $
  371. +  * Revision 3.4.1.1  89/03/20  00:10:06  louie
  372. +  * patch1: sys.refid could have garbage left if the peer we're synchronized to
  373. +  * patch1: is lost.
  374. +  * 
  375.    * Revision 3.4  89/03/17  18:37:05  louie
  376.    * Latest test release.
  377.    * 
  378. ***************
  379. *** 774,779 ****
  380. --- 778,784 ----
  381.   #endif
  382.           sys.peer = NULL;
  383.           sys.stratum = 0;
  384. +         sys.refid = 'N'<<24 | 'O'<<16 | 'N'<<8 | 'E';
  385.           return;
  386.       }
  387.   
  388.  
  389. Index: ntpd.c
  390. Prereq: 3.4
  391. *** ntpd.c.old    Mon Mar 20 00:15:29 1989
  392. --- ntpd.c    Mon Mar 20 00:15:30 1989
  393. ***************
  394. *** 1,9 ****
  395.   #ifndef    lint
  396. ! static char *rcsid = "$Header: /usr/users/louie/ntp/RCS/ntpd.c,v 3.4 89/03/17 18:37:11 louie Exp $";
  397.   #endif    lint
  398.   
  399.   /*
  400.    *  $Log:    ntpd.c,v $
  401.    * Revision 3.4  89/03/17  18:37:11  louie
  402.    * Latest test release.
  403.    * 
  404. --- 1,15 ----
  405.   #ifndef    lint
  406. ! static char *rcsid = "$Header: /usr/users/louie/ntp/RCS/ntpd.c,v 3.4.1.1 89/03/20 00:12:10 louie Exp Locker: louie $";
  407.   #endif    lint
  408.   
  409.   /*
  410.    *  $Log:    ntpd.c,v $
  411. +  * Revision 3.4.1.1  89/03/20  00:12:10  louie
  412. +  * patch1: Diddle syslog messages a bit.  Handle case of udp/ntp not being
  413. +  * patch1: defined in /etc/services.  Compute default value for tickadj if
  414. +  * patch1: the change-kernel-tickadj flag is set, but no tickadj directive
  415. +  * patch1: is present in the configuration file.
  416. +  * 
  417.    * Revision 3.4  89/03/17  18:37:11  louie
  418.    * Latest test release.
  419.    * 
  420. ***************
  421. *** 225,235 ****
  422.           setlogmask(LOG_UPTO(LOG_INFO));
  423.   #endif    /* LOG_DAEMON */
  424.   
  425. !     syslog(LOG_INFO, "%s version $Revision: 3.4 $ patchlevel %d",
  426. !            prog_name, PATCHLEVEL);
  427.   #ifdef    DEBUG
  428.       if (debug)
  429. !         printf("%s version $Revision: 3.4 $ patchlevel %d\n",
  430.                  prog_name, PATCHLEVEL);
  431.   #endif
  432.       (void) setpriority(PRIO_PROCESS, 0, -10);
  433. --- 231,242 ----
  434.           setlogmask(LOG_UPTO(LOG_INFO));
  435.   #endif    /* LOG_DAEMON */
  436.   
  437. !     syslog(LOG_NOTICE, "%s version $Revision: 3.4.1.1 $", prog_name);
  438. !     syslog(LOG_NOTICE, "patchlevel %d", PATCHLEVEL);
  439.   #ifdef    DEBUG
  440.       if (debug)
  441. !         printf("%s version $Revision: 3.4.1.1 $ patchlevel %d\n",
  442.                  prog_name, PATCHLEVEL);
  443.   #endif
  444.       (void) setpriority(PRIO_PROCESS, 0, -10);
  445. ***************
  446. *** 236,249 ****
  447.   
  448.       servp = getservbyname("ntp", "udp");
  449.       if (servp == NULL) {
  450. !         syslog(LOG_CRIT, "udp/ntp: service unknown\n");
  451. !         exit(1);
  452. !     }
  453.   
  454.       peer_list.head = peer_list.tail = NULL;
  455.       peer_list.members = 0;
  456.   
  457. -     (void) create_sockets(servp->s_port);
  458.       init_ntp(conf);
  459.       init_kern_vars();
  460.       init_logical_clock();
  461. --- 243,258 ----
  462.   
  463.       servp = getservbyname("ntp", "udp");
  464.       if (servp == NULL) {
  465. !         syslog(LOG_CRIT, "udp/ntp: service unknown, using default %d",
  466. !                NTP_PORT);
  467. !         (void) create_sockets(htons(NTP_PORT));
  468. !     } else
  469. !         (void) create_sockets(servp->s_port);
  470.   
  471.       peer_list.head = peer_list.tail = NULL;
  472.       peer_list.members = 0;
  473.   
  474.       init_ntp(conf);
  475.       init_kern_vars();
  476.       init_logical_clock();
  477. ***************
  478. *** 295,302 ****
  479.   #endif
  480.       selfds++;
  481.   
  482. -     syslog(LOG_INFO, "%d sockets open", nintf);
  483.       (void) setitimer(ITIMER_REAL, itp, (struct itimerval *) 0);
  484.   
  485.       for (;;) {        /* go into a finite but hopefully very long
  486. --- 304,309 ----
  487. ***************
  488. *** 889,894 ****
  489. --- 896,911 ----
  490.                  dotickadj);
  491.       }
  492.   #endif
  493. +     /*
  494. +      *  If desired value of tickadj is not specified in the configuration
  495. +      *  file, compute a "reasonable" value here, based on the assumption 
  496. +      *  that we don't have to slew more than 2ms every 4 seconds.
  497. +      *
  498. +      *  TODO: the 500 needs to be parameterized.
  499. +      */
  500. +     if (tickadj == 0 && kern_hz)
  501. +         tickadj = 500/kern_hz;
  502.       if (dotickadj && tickadj && (tickadj != kern_tickadj)) {
  503.           close(kmem);
  504.           if ((kmem = open(memory, O_RDWR)) >= 0) {
  505.  
  506. Index: ntpdc.c
  507. Prereq: 3.4
  508. *** ntpdc.c.old    Mon Mar 20 00:15:35 1989
  509. --- ntpdc.c    Mon Mar 20 00:15:35 1989
  510. ***************
  511. *** 1,9 ****
  512.   #ifndef    lint
  513. ! static char *RCSid = "$Header: /usr/users/louie/ntp/RCS/ntpdc.c,v 3.4 89/03/17 18:37:16 louie Exp $";
  514.   #endif
  515.   
  516.   /*
  517.    * $Log:    ntpdc.c,v $
  518.    * Revision 3.4  89/03/17  18:37:16  louie
  519.    * Latest test release.
  520.    * 
  521. --- 1,15 ----
  522.   #ifndef    lint
  523. ! static char *RCSid = "$Header: /usr/users/louie/ntp/RCS/ntpdc.c,v 3.4.1.1 89/03/20 00:13:41 louie Exp Locker: louie $";
  524.   #endif
  525.   
  526.   /*
  527.    * $Log:    ntpdc.c,v $
  528. +  * Revision 3.4.1.1  89/03/20  00:13:41  louie
  529. +  * patch1: Delete unused variables.  Display interface address in numeric form
  530. +  * patch1: for local address, rather than symbolically.  For multiple host
  531. +  * patch1: queries, the name of the host is emitted prior to the data for that
  532. +  * patch1: host.
  533. +  * 
  534.    * Revision 3.4  89/03/17  18:37:16  louie
  535.    * Latest test release.
  536.    * 
  537. ***************
  538. *** 84,90 ****
  539.       int argc;
  540.       char *argv[];
  541.   {
  542. -     int count = 0;
  543.       char *p;
  544.       int on = 48*1024;
  545.   
  546. --- 90,95 ----
  547. ***************
  548. *** 116,121 ****
  549. --- 121,128 ----
  550.           }
  551.           argc--, argv++;
  552.       }
  553. +     if (argc > 1)
  554. +         printf("--- %s ---\n", *argv);
  555.       while (argc > 0) {
  556.           /*
  557.            * Get a new socket each time - this will cause us to ignore
  558. ***************
  559. *** 134,140 ****
  560.           query(*argv);
  561.           answer();
  562.           close(s);
  563. !         argv++, argc--;
  564.       }
  565.   
  566.   }
  567. --- 141,149 ----
  568.           query(*argv);
  569.           answer();
  570.           close(s);
  571. !         argv++;
  572. !         if (argc-- > 1)
  573. !             printf("--- %s ---\n", *argv);
  574.       }
  575.   
  576.   }
  577. ***************
  578. *** 264,270 ****
  579.       double offset[PEER_SHIFT], delay[PEER_SHIFT], dsp,del,off;
  580.       char c;
  581.       char *cvthname();
  582. -     static int count = 0;
  583.   
  584.       sin.sin_addr.s_addr = n->net_address;
  585.       for (i = 0; i < PEER_SHIFT; i++) {
  586. --- 273,278 ----
  587. ***************
  588. *** 283,289 ****
  589.       printf("%c%-15.15s ", c, cvthname(&sin));
  590.       sin.sin_addr.s_addr = n->my_address;
  591.       printf("%-16.16s %2d %4d  %03o  %8.1f %8.1f %8.1f\n",
  592. !            sin.sin_addr.s_addr ? cvthname(&sin) : "wildcard", 
  593.              n->stratum, (int)ntohl((u_long)n->timer), 
  594.              ntohs(n->reach) & SHIFT_MASK, del, off, dsp);
  595.   }    
  596. --- 291,297 ----
  597.       printf("%c%-15.15s ", c, cvthname(&sin));
  598.       sin.sin_addr.s_addr = n->my_address;
  599.       printf("%-16.16s %2d %4d  %03o  %8.1f %8.1f %8.1f\n",
  600. !            sin.sin_addr.s_addr ? inet_ntoa(sin.sin_addr) : "wildcard", 
  601.              n->stratum, (int)ntohl((u_long)n->timer), 
  602.              ntohs(n->reach) & SHIFT_MASK, del, off, dsp);
  603.   }    
  604.  
  605. Index: stat.pl
  606. Prereq: 3.4
  607. *** stat.pl.old    Mon Mar 20 00:15:39 1989
  608. --- stat.pl    Mon Mar 20 00:15:40 1989
  609. ***************
  610. *** 15,23 ****
  611.   #
  612.   #  The -S option will "save" the intermedite data files, which are normally
  613.   #  deleted.
  614.   
  615. - #  Extract drift value from the hourly stat: syslog message.
  616.   #
  617.   # Mar  7 18:46:58 trantor ntpd[20838]: adjust: SLEW 192.41.177.92 st 2 
  618.   #    off -0.015756 drft 0.000000 cmpl 0.000000
  619. --- 15,26 ----
  620.   #
  621.   #  The -S option will "save" the intermedite data files, which are normally
  622.   #  deleted.
  623. + #
  624. + #  Louis A. Mamakos <louie@TRANTOR.UMD.EDU>
  625. + #  with many thanks to Larry Wall for `perl', a wonderful tool for hacking
  626. + #  up things like this so easily.
  627. + #
  628.   
  629.   #
  630.   # Mar  7 18:46:58 trantor ntpd[20838]: adjust: SLEW 192.41.177.92 st 2 
  631.   #    off -0.015756 drft 0.000000 cmpl 0.000000
  632. ***************
  633. *** 25,30 ****
  634. --- 28,35 ----
  635.   #    was 130.126.174.40 stratum 1
  636.   #
  637.   #
  638. + $scriptfile = $0;
  639.   $month{'Jan'} = 0; $month{'Feb'} = 1; $month{'Mar'} = 2; $month{'Apr'} = 3;
  640.   $month{'May'} = 4; $month{'Jun'} = 5; $month{'Jul'} = 6; $month{'Aug'} = 7;
  641.   $month{'Sep'} = 8; $month{'Oct'} = 9; $month{'Nov'} = 10; $month{'Dec'} = 11;
  642. ***************
  643. *** 34,39 ****
  644. --- 39,45 ----
  645.   die "Can't open compliance file\n" unless open(COMP, ">stats.comp");
  646.   die "Can't open clock file\n" unless open(CLK, ">stats.clk");
  647.   
  648. + $# = '%.6g';
  649.   $plottype = "postscript";
  650.   $recs = 0;
  651.   $start = 0;
  652. ***************
  653. *** 40,47 ****
  654.   $clocks = 1;
  655.   $clk{'UNSYNCED'} = 0;
  656.   
  657. ! do Getopt('ti');
  658.   
  659.   if ($opt_t) {
  660.       $plottype = $opt_t;
  661.   }
  662. --- 46,57 ----
  663.   $clocks = 1;
  664.   $clk{'UNSYNCED'} = 0;
  665.   
  666. ! do Getopt('tiSo');
  667.   
  668. + if ($opt_h) {
  669. +    die "Usage: $scriptfile [-o outputfile] [-i interval] [-t termtype] [-S] < logmessages\n";
  670. + }
  671.   if ($opt_t) {
  672.       $plottype = $opt_t;
  673.   }
  674. ***************
  675. *** 107,113 ****
  676.       }
  677.   }
  678.   
  679. ! $last = int($t + 0.99999);
  680.   printf "%d records spanning %4.2f hours.\n", $recs, $t;
  681.   
  682.   close OFF;
  683. --- 117,127 ----
  684.       }
  685.   }
  686.   
  687. ! if ($t = int($t)) {
  688. !     $last = int($t) + 1;
  689. ! } else {
  690. !     $last = int($t);
  691. ! }
  692.   printf "%d records spanning %4.2f hours.\n", $recs, $t;
  693.   
  694.   close OFF;
  695. ***************
  696. *** 131,143 ****
  697.   #
  698.   print TMP "set samples ",$recs,"\n";
  699.   print TMP "set term $plottype\n";
  700. - print TMP 'set output "stats.plot"'; print TMP "\n";
  701.   
  702.   if ($interval > $last) {
  703. !     print "Interval truncated to available data ($last)\n";
  704.       $interval = $last;
  705.   }
  706.   $start = 0;
  707.   $end = $interval;
  708.   while (($start < $last)) {
  709. --- 145,167 ----
  710.   #
  711.   print TMP "set samples ",$recs,"\n";
  712.   print TMP "set term $plottype\n";
  713.   
  714. + if ($opt_o) {
  715. +     printf TMP 'set output "%s"', $opt_o; print TMP "\n";
  716. + } else {
  717. +     print TMP 'set output "stats.plot"'; print TMP "\n";
  718. + }
  719.   if ($interval > $last) {
  720. !     if ($interval != 99999999) {
  721. !         print "Interval truncated to available data ($last)\n";
  722. !     }
  723.       $interval = $last;
  724.   }
  725. ! #
  726. ! #  Plot multiple sets of plots, each set of which covers the specified number
  727. ! #  of hours.
  728. ! #
  729.   $start = 0;
  730.   $end = $interval;
  731.   while (($start < $last)) {
  732. ***************
  733. *** 167,173 ****
  734.       unlink "stats.clk";
  735.   }
  736.   
  737. ! ;# $Header: /usr/users/louie/ntp/RCS/stat.pl,v 3.4 89/03/17 18:37:30 louie Exp $
  738.   
  739.   ;# Process single-character switches with switch clustering.  Pass one argument
  740.   ;# which is a string containing all switches that take an argument.  For each
  741. --- 191,197 ----
  742.       unlink "stats.clk";
  743.   }
  744.   
  745. ! ;# $Header: /usr/users/louie/ntp/RCS/stat.pl,v 3.4.1.1 89/03/20 00:14:56 louie Exp Locker: louie $
  746.   
  747.   ;# Process single-character switches with switch clustering.  Pass one argument
  748.   ;# which is a string containing all switches that take an argument.  For each
  749.